/**
 * 项目示例-列表表头
 * Date 2023-5-25 09:33:56
 * 可选参数可参考：https://element-plus.org/zh-CN/component/table.html#table-column-属性
 */
interface ExampleListItem {
    eqptCode: string;
    eqptType: string;
    eqptName: string;
    eqptModel: string;
    useOrgans: string;
    owner: string;
    position: string;
    coordinate: string;
}

export const mapListColumns = [
    // { type: 'selection', width: 60 },
    {type: 'index', label: '序号', width: 60, align: 'center'},
    {
        prop: 'eqptCode',
        label: '设备编号',
        sortable: true,
        width: 130,
        align: 'center',
        formatter(row: any, column: any, cellValue: any) {
            if (cellValue && cellValue.trim() != '') {
                return cellValue
            } else {
                return "-"
            }
        }
    },
    {
        prop: 'typeName', label: '设备类型', minWidth: 130, align: 'center'
    },
    {
        prop: 'eqptName',
        label: '设备名称',
        sortable: true,
        minWidth: 200,
        align: 'center',
        formatter(row: any, column: any, cellValue: any) {
            if (cellValue && cellValue.trim() != '') {
                return cellValue
            } else {
                return "-"
            }
        }
    },
    {
        prop: 'eqptModel',
        label: '设备型号',
        minWidth: 120,
        align: 'center',
        formatter(row: any, column: any, cellValue: any) {
            if (cellValue && cellValue.trim() != '') {
                return cellValue
            } else {
                return "-"
            }
        }
    },
    {
        prop: 'useOrgans', label: '使用部门', minWidth: 120, align: 'center',
        formatter: function (row: any, column: any, cellValue: any = []) {
            var str = ''
            if (cellValue.length > 0) {
                for (let i of cellValue) {
                    if (cellValue == undefined) {
                        return "-"
                    } else if (i.organName == ' ') {
                        return "-"
                    }
                    if (i.organName) {
                        str += i.organName
                        str += ' '
                    }
                }
                return str
            }
            return '-'
        }
    },
    {
        prop: 'ownerName',
        label: '归属单位',
        minWidth: 120,
        align: 'center',
        formatter(row: any, column: any, cellValue: any) {
            if (cellValue && cellValue.trim() != '') {
                return cellValue
            } else {
                return "-"
            }
        }
    },
    {
        prop: 'position',
        label: '位置',
        width: 210,
        align: 'center',
        formatter(row: any, column: any, cellValue: any) {
            if (cellValue && cellValue.trim() != '') {
                return cellValue
            } else {
                return "-"
            }
        }
    },
    {
        prop: 'coordinate', label: '地图坐标', width: 215, align: 'center',
        formatter: function (row: any, column: any, cellValue: any = {latitude: 0, longitude: 0}) {
            if (cellValue.latitude && cellValue.longitude) {
                return `(${cellValue.latitude},${cellValue.longitude})`
            } else {
                return "-"
            }
        }
    },
    {prop: 'action', label: '操作', fixed: 'right', width: 210, align: 'center'}
]
export const thresholdListColumns = [
    {prop: 'area', label: '区域', width: 80, align: 'center',type:'string'},
    {prop: 'historicalAverage', label: '历史平均值', minWidth: 100, align: 'center',type:'string'},
    {prop: 'isAlarm', label: '是否报警', minWidth: 100, align: 'center',type:'string'},
    {prop: 'setThreshold', label: '设置阈值', minWidth: 100, align: 'center',type:'string'}
]
